

;
var helper = require("../../javascript/helper");
var db = require("../../javascript/mysql");

let mysql = new db.mysqlClient("accident");
function genProductInfo( ) {
    let prices = ["52.00","68.00","100.00","128.00","272.00","328.00"]
    plan = {
        "planA":{
            "year":["0-65"],
            "days":["1y"],
            "people_count":["1"],
            "accident_death":["30000"],
            "airplane_death":["200000"],
            "train_death":["50000"],
            "ship_death":["50000"],
            "bus_death":["50000"],
            "common_traffic":["1"],
            "accident_medical":["","3000"],
        },
        "planB":{
            "year":["0-65"],
            "days":["1y"],
            "people_count":["1"],
            "accident_death":["80000"],
            "airplane_death":["400000"],
            "train_death":["100000"],
            "ship_death":["100000"],
            "bus_death":["50000"],
            "common_traffic":["1"],
            "accident_medical":["","5000"],

        },
        "planC":{
            "year":["0-65"],
            "days":["1y"],
            "people_count":["1"],
            "accident_death":["200000"],
            "airplane_death":["1000000"],
            "train_death":["500000"],
            "ship_death":["500000"],
            "bus_death":["1"],
            "common_traffic":["400000"],
            "accident_medical":["","10000"],
        }
    }
    let index = 0
    for(k in plan){
        data = helper.product([plan[k]["year"],plan[k]["days"],plan[k]["people_count"],plan[k]["accident_death"],plan[k]["airplane_death"],plan[k]["train_death"],plan[k]["ship_death"],plan[k]["bus_death"],plan[k]["common_traffic"],plan[k]["accident_medical"]])
        for(i=0;i<data.length;i++){
            rs = helper.formatProductInfo(data[i],plan[k])
            rs.name = "e时代综合意外保险产品计划（新）"
            rs.company = "中国人民保险"
            rs.price = prices[index]
            mysql.insertData( rs );
        
        }

    }
    mysql.close();
    
}
